package cn.itcast.zt.threadpool;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author zhangtian105
 * @ClassName PrintingPolicy.java
 * @projectName SpringBoot2.x
 * @Description 拒绝策略
 * @createTime 2020年05月19日 15:07:00
 */
@Slf4j
public class PrintingPolicy implements RejectedExecutionHandler {
    public PrintingPolicy() {

    }

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        log.info("自定义拒绝策略:Task:{}, rejected from:{}", r.toString(), executor.toString());
    }
}
